//
//  UIColor+Extension.swift
//  HinsLive
//
//  Created by haoxian on 2019/4/16.
//  Copyright © 2019 Hins. All rights reserved.
//

import UIKit


extension UIColor {
    static func colorWith(_ red: CGFloat,
                          _ green: CGFloat,
                          _ blue: CGFloat,
                          _ alpha: CGFloat = 1.0) -> UIColor {
        guard 0 <= red,   red   <= 255.0 else { fatalError() }
        guard 0 <= green, green <= 255.0 else { fatalError() }
        guard 0 <= blue,  blue  <= 255.0 else { fatalError() }
        guard 0 <= alpha, alpha <= 1.0   else { fatalError() }
        return UIColor(red: red/255.0, green: green/255.0, blue: blue/255.0, alpha: alpha)
    }
    
    static func random() -> UIColor {
        let r = CGFloat.random(in: 0...255.0)
        let g = CGFloat.random(in: 0...255.0)
        let b = CGFloat.random(in: 0...255.0)
        return .colorWith(r, g, b)
    }
}


extension UIColor {
    static var standardColor: UIColor {
        return .colorWith(199, 145, 90)
    }
    
    static var tabbarTitleNormalColor: UIColor {
        return .black
    }
    
    static var tabbarTitleSelectedColor: UIColor {
        return .standardColor
    }
    
    static var commonBackgroundColor: UIColor {
        return .white
    }
    
    static var imagePlaceholderColor: UIColor {
        return .colorWith(222, 222, 222)
    }
    
    static var roomGrayBackgroundColor: UIColor {
        return UIColor(white: 0.2, alpha: 0.3)
    }
}
